<?php

namespace app\index\controller;

use think\Controller;
use think\Request;
use app\index\model\Blog as BlogModel;
class Blog
{
 // 根据id查询
    public function query()
    {
		$id = input('get.id');
		$blog = new BlogModel();
		$res = $blog::get($id);
		return json($res);
    }
	// 保存
	public function save(){
		$blog = new BlogModel();
		$blog->content = 'content';
		$blog->uid = 2;
		$blog->save();
	}
	// 修改
	public function update(){
		$blog = BlogModel::get(1);
		$blog->content = '修改';
		$blog->save();
	}
	//删除
	public function delete(){
		$blog = BlogModel::get(2);
		$blog->delete();
	}
}
